<?php

namespace App\Models\Oauth;

use Illuminate\Support\Facades\DB;
use App\Models\Model;

class DistrictModel extends Model
{

    const TABLENAME = 'tw_base_district';

    /**
     * 初始化并返回数据库请求构建器
     *
     * @return Illuminate\Support\Facades\DB::table(TABLENAME)
     */
    public static function dbTable()
    {
        // return self::dbConnectionClub()->table(self::TABLE_NAME);
        return DB::table(self::TABLENAME);
    }

    /**
     * 查询一条地址相关信息
     */
    public static function getDistrict($where = array())
    {
        return self::dbTable()
               ->where($where)
               ->first();
    }

    public static function getDistricts($where = array())
    {
        return self::dbTable()
            ->where($where)
            ->get();
    }
}

?>